<template>
  <component :is="componentId" :class="pageClass">
    <template #header v-if="$slots.header">
      <slot name="header"></slot>
    </template>
    <div class="app-page-main">
      <slot></slot>
    </div>
    <div class="app-page-footer">
      <slot name="footer"></slot>
    </div>
  </component>
</template>

<script>
export default {
  name: 'AppPage',
  components: {},
  props: {
    card: {
      type: Boolean,
      default: false,
    },
    full: {
      type: Boolean,
      default: false,
    },
  },

  data() {
    return {}
  },

  computed: {
    componentId() {
      if (this.card) return 'el-card'

      return 'div'
    },
    pageClass() {
      let pageClass = {
        'app-page': true,
      }
      if (this.card) pageClass['app-page-card'] = true
      if (this.full) pageClass['app-page-full'] = true

      return pageClass
    },
  },

  watch: {},

  created() {},

  methods: {},
}
</script>

<style lang="scss" scoped></style>
